@extends('layouts.admin')
@section('title') @parent 文章列表 @stop
@section('page_title')@parent
文章列表
@show
@section('breadcrumb')@parent
{{ Breadcrumbs::render('article-index')  }}
@show
@section('content')
<div class="box">
		<div class="box-header">
			<h3 class="box-title">文章</h3>
		</div>
		<div class="box-body table-responsive">	
				@include('widgets.notification')
				<div role="grid" class="dataTables_wrapper form-inline" id="example1_wrapper">
					{{ Form::open(array('method' => 'GET', 'class'=>'form-inline frm')) }}
					文章状态分类 {{ Form::select('status', $status_list, $status) }}
					文章分类 {{ Form::select('class', $article_class_list, $class) }}
					法律类型 {{ Form::select('law_cat', $law_cat_list, $law_cat) }}
					文章标题 <input type="text" name="keywords" value="{{ $keywords }}" placeholder="请输入关键字">
					<button class="btn btn-sm btn-default" type="submit">查询</button>
					{{ Form::close() }}
				</div>
				<table class="table table-bordered table-hover dataTable">
					<thead>
					<tr>
						<th>编号</th>
						<th>栏目</th>
						<th>文章标题</th>
						<th>点击数</th>
						<th>下载数</th>
						<th>状态</th>
						<th>添加日期</th>
						<th>操作</th>
					</tr>
					</thead>
					<tbody>
							@if(count($datas)>0)
							@foreach ($datas as $article)
							<tr>
								<td>{{ $article->id }}</td>
								<td>{{ $article_class_list[$article->class] }}</td>
								<td><a href="{{ route('admin.article.from_lawyer.index') }}?law_cat={{ $article->law_cat }}">[{{ $law_cat_list[$article->law_cat] }}]</a>{{$article->title }}</td>
								<td>{{ $article->hits }}</td>
								<td>{{ $article->downs }}</td>
								<td>{{ $status_list[$article->status] }}</td>
								<td>{{ $article->created_at }}</td>
								<td>
									@if($article->status === 0)<a href="{{ route('admin.article.view', $article->id) }}" title="审核">审核</a>&nbsp;&nbsp;@endif <a href="javascript:void(0)" id="d_{{ $article->id }}" class="btn-del">&nbsp;&nbsp;<span class="glyphicon glyphicon-remove danger"></span></a>
								</td>
							</tr>
							@endforeach
							@endif
					</tbody>
				</table>
		</div>
		<div class="box-footer clearfix">
			{{ $datas->appends(Input::except('page'))->links() }}
		</div>
</div>
@stop
@section('end') @parent
<script type="text/javascript">
$(function() {
		$(document).on('click', '.btn-del', function(){
			if(confirm("你确定要删除该文章么？"))
			{
					var $id = $(this).attr("id").split('_')[1];
					$('<input type="hidden" name="_method" value="DELETE" />').insertAfter($(this));
					$('.frm').attr('action', "/admins/articles/" + $id +"/delete");
					$('.frm').submit();
			}
		})
});
</script>
@stop
